package com.ruicar.afs.cloud.bizcommon.rules.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.ruicar.afs.cloud.bizcommon.dto.rules.atom.AfsRuleCopyDto;
import com.ruicar.afs.cloud.bizcommon.dto.rules.atom.AfsRuleInfoDto;
import com.ruicar.afs.cloud.bizcommon.dto.rules.tree.RuleTreeDto;
import com.ruicar.afs.cloud.bizcommon.rules.entity.AfsRuleInfo;

import java.util.Date;
import java.util.List;
import java.util.function.Function;

public interface AfsRuleInfoService extends IService<AfsRuleInfo> {
    AfsRuleInfoDto checkRule(AfsRuleInfoDto afsRuleInfoDto);

    AfsRuleInfoDto checkAndSaveRule(AfsRuleInfoDto afsRuleInfoDto);

    void saveRuleOut(AfsRuleInfoDto afsRuleInfoDto);

    List<RuleTreeDto> loadRuleTree(Long ruleId);

    boolean activeRule(Long ruleId);

    <T,R> boolean  activeRule(Long ruleId, Function<T,R> function,T param);

    boolean activeRuleWithoutPublish(Long ruleId);

    boolean changeRuleDate(Long ruleId, Date startDate, Date endDate);

    boolean expiredRule(Long ruleId);

    boolean deleteRule(Long ruleId);

    boolean deActiveRule(Long ruleId);

    <T,R>   boolean deActiveRule(Long ruleId, Function<T,R> function,T param);

    boolean deActiveRuleWithoutPublish(Long ruleId);

    Long copyRule(AfsRuleCopyDto afsRuleCopyDto);
}
